from PyQt4 import QtCore, QtGui; #@UnusedImport

class ColorStyle():    
    def getColorStyle(self, iOpc, k):
        k = 1 if k>1 else k;
        k = 0 if k<0 else k;
        #color = QtGui.QColor(k,k,k, 255);
        color = QtGui.QColor();
        k = k*255;
        if iOpc==0: #None [White]
            color.setRgb(255,255,255, 255);
        if iOpc==1: #Green Gradient
            color.setHsv(120,k*0.7,255-k/2.3);
        elif iOpc==2: #Red-Green Gradient
            color.setHsv(120*(k/255.0),255,255-k/1.7);
        elif iOpc==3: #Blue Gradient
            color.setHsv(240,k*0.7,255);
        elif iOpc==4: #Red-Green Gradient
            k = 255-k;
            color.setHsv(120*(k/255.0),255,255-k/1.7);
        elif iOpc==5: #Gray Gradient
            color.setRgb(255-k/2.5, 255-k/2.5, 255-k/2.5);
        return color;
    
    def setFormatRed(self, qCell):
        colorFnt = QtGui.QColor(156,0,6);
        colorBkg = QtGui.QColor(255,199,206);
        qCell.setBackground(QtGui.QBrush(colorBkg));
        qCell.setForeground(QtGui.QBrush(colorFnt));
    
    def setFormatGreen(self, qCell):
        colorFnt = QtGui.QColor(0,97,0);
        colorBkg = QtGui.QColor(198,239,206);
        qCell.setBackground(QtGui.QBrush(colorBkg));
        qCell.setForeground(QtGui.QBrush(colorFnt));